﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OrderAggregator.DataStorage;


namespace OrderAggregator.Core
{
    /// <summary>
    /// Заказ в цех
    /// </summary>
    public class DepartmetOrder
    {
        private readonly Storage.DepartmentRow _department;
        private readonly Storage.OrganizationRow _organization;
        private readonly List<DepartmetOrderRow> _orderRows = new List<DepartmetOrderRow>();

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="department"></param>
        /// <param name="organization"></param>
        public DepartmetOrder(Storage.DepartmentRow department, Storage.OrganizationRow organization)
        {
            _department = department;
            _organization = organization;
        }

        /// <summary>
        /// Дата-время
        /// </summary>
        public DateTime Date
        {
            get;
            set;
        }

        /// <summary>
        /// Дата
        /// </summary>
        public string DateString
        {
            get
            {
                return Date.ToShortDateString();
            }
        }

        /// <summary>
        /// Организация заказчик
        /// </summary>
        public Storage.OrganizationRow Organization
        {
            get
            {
                return _organization;
            }
        }

        /// <summary>
        /// Цех
        /// </summary>
        public Storage.DepartmentRow Department
        {
            get
            {
                return _department;
            }
        }

        /// <summary>
        /// Позиции заказа
        /// </summary>
        public List<DepartmetOrderRow> OrderRows
        {
            get
            {
                return _orderRows;
            }
        }
    }
}
